-
Notifications
You must be signed in to change notification settings - Fork 936
Add doc_comment_code_block_small_heuristics
, to override use_small_heuristics
in doc code
#6616
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Add doc_comment_code_block_small_heuristics
, to override use_small_heuristics
in doc code
#6616
Conversation
This allows overriding `use_small_heuristics` in doc code. This is particularly useful for code that wants to use `use_small_heuristics = "Max"` internally but present doctests and examples using `use_small_heuristics = "Default"`.
This test is based on the `use_small_heuristics` tests. It tests that the code *outside* the doc comment gets formatted using `Max`, while the code inside doc comments gets formatted using `Default`.
190fe00
to
a0dc042
Compare
is doc_comment_code_block_width not enough to override the width settings when formatting code blocks? |
@ytmimi No, because if you're using |
It wasn't originally clear to me but now I understand. You want a way to override all width settings when formatting code blocks in doc comments. |
Or in this case un-override them, yes. I'm hoping to use this in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to expand on the test cases. It would be nice to have tests that cover the various combinations of use_small_heuristics
and doc_comment_code_block_small_heuristics
.
This test goes from Default to Max heuristics.
@ytmimi Done. |
This (unstable) configuration option allows overriding
use_small_heuristics
for doc code. This is particularly useful for code that wants to useuse_small_heuristics = "Max"
internally but present doctests and examples usinguse_small_heuristics = "Default"
.This has come up before in the context of formatting the standard library, which uses
use_small_heuristics = "Max"
internally, but wants to present documentation and examples in the style most people will normally see.